#
#  $Id: Makefile,v 1.3 2006/09/12 13:51:55 joel Exp $
#

#
# Used by bootstrap to handle this.
#
ACLOCAL_AMFLAGS = -I aclocal

#
# Access the BSP configuration.
#
include $(srcdir)/automake/bsp-compile.am

#
# List the programs we want to build.
#
bin_PROGRAMS = \
	iso9660


#
# Charset handler
#
if HAVE_ICONV
CHARSET_HANDLER_SRC = iso9660/iso9660_charset.c
else
CHARSET_HANDLER_SRC = iso9660/iso9660_charset_stub.c
endif

#
# ISO9660 filesystem sources
#
iso9660fs_SRC = \
	iso9660/iso9660fs.c \
	iso9660/iso9660_init.c \
	iso9660/iso9660_init_supp.c \
	iso9660/iso9660_handlers_directory.c \
	iso9660/iso9660_handlers_file.c \
  iso9660/iso9660_io.c \
  iso9660/iso9660_io_bd.c \
  iso9660/iso9660_io_file.c \
  iso9660/iso9660_record.c \
  iso9660/iso9660_susp.c \
  iso9660/iso9660_shell.c \
  iso9660/iso9660_dbg.c \
  $(CHARSET_HANDLER_SRC)
	
#
# GDB debug
#

if PC586
PC586_GDB = pc386-gdb.c
PC586_SRC = \
	$(PC586_GDB)
LIBBSDPORT = -lif_re -lif_fxp -lbsdport
endif
	


#
# List the C Application sources, cflags and linker options.
#
iso9660_CFLAGS = -Wall -Wimplicit-function-declaration -Wstrict-prototypes \
                         -Wnested-externs -fasm \
                         -Iiso9660/ -I$(srcdir)/iso9660/ \
                         -pedantic
                         
iso9660_SOURCES = \
	iso9660.c \
	$(iso9660fs_SRC) \
  $(PC586_SRC)

iso9660_LDADD = \
	iso-collection-tarfile.o \
	$(LIBBSDPORT) -lrtemsbsp -lrtemscpu -lnfs

$(iso9660fs_SOURCES): iso9660/iso9660.h iso9660/iso9660fs.h

iso-collection-tarfile.o: utilities/iso1.iso
	(cd $(srcdir)/utilities && tar cfh - iso3.iso) > iso-collection.tar
	$(OBJCOPY) -I binary -B $(RTEMS_CPU) -O $(RTEMS_OBJ_FORMAT) \
		 iso-collection.tar $@

#
# Access the BSP post link commands.
#
include $(srcdir)/automake/bsp-post-link.am
